require 'tk'
require 'tkextlib/tkimg'

Top = {side:'top',padx:5,pady:5}
Left = {side:'left',padx:5,pady:5}
Bottom = {side:'bottom',padx:5,pady:5}

up_img = TkPhotoImage.new(file:"up.png")
down_img = TkPhotoImage.new(file:"down.png")

temp = 55

root = TkRoot.new(title:"Hello Thermostat 2015")
root.geometry("300x140")

top = TkFrame.new(root){
	bg "#909090"
}
bottom = TkFrame.new(root){
	height 150
}

tlab = TkLabel.new(top){
	text temp.to_s
	font "Arial 54 bold"
	fg "light green"
	bg "#909090"
	pack Left
}

TkLabel.new(top){
	text "o"
	font "Arial 14 bold"
	fg "light green"
	bg "#909090"
	pack Left.update(anchor:'ne')
}

TkButton.new(bottom){
	#text " Up "
	image up_img
	width 50
	height 50
	#compound "top"
	#justify "center"
	command {
		tlab.configure(text:(temp+=1).to_s)
	}
	pack Left
}

TkButton.new(bottom){
	#text "Down"
	image down_img
	width 50
	height 50
	#compound "top"
	#justify "center"
	command{
		tlab.configure(text:(temp-=1).to_s)
	}
	pack Left
}

top.pack Top
bottom.pack Bottom

Tk.mainloop